using FluentNHibernate.Mapping;
using Munim.Fame.Core.DomainModels;

namespace Munim.Fame.DataAccess.NHibernate.Mapping
{
    public sealed class MemberMap: ClassMap<Member>
    {
        public MemberMap()
        {
            Id(m => m.Id);
            Map(m => m.FirstName);
            Map(m => m.LastName);
            Map(m => m.DateOfBirth);
            Map(m => m.HomePhone).Nullable();
            Map(m => m.OfficePhone).Nullable();
            Map(m => m.MobilePhone);
            Map(m => m.EMail).Unique();
            References(m => m.MemberType).LazyLoad();
            HasMany(m => m.Rent).Table("Rent").ExtraLazyLoad();

        }
    }
}
